      *> File Name     000021_Generic.cbl.
      *> Description   Defining and using a generic class.
      *> Project Type  Console Application.
      *> CodePlex URL  http://cobol.codeplex.com/
       
       program-id.   Main.
       repository.
           class sys-console as "System.Console"
           .
       working-storage section.
       01  kvp  type "KeyValuePair"[string, binary-char].
       procedure division.
           move "Defining and Using a Generic Class"
               to sys-console::"Title"
           
           move type "KeyValuePair"[string, binary-char]::"New"(
               "test", 123) to kvp
 
           display kvp
               
           display "Press any key to continue . . . " no advancing
           invoke sys-console::"ReadKey"(true)
           .
       end program   Main.
 
       class-id.     KeyValuePair using T, U.
       constraints.
           constrain T implements type "System.IComparable"
           .
       working-storage section.
       01  KeyMember    T public.
       01  ValueMember  U public.
      *>
       method-id.    New.
       procedure division using by value k as T, v as U.
           move k to KeyMember
           move v to ValueMember
           .
       end method    New.
      *>
       method-id.   ToString override.
       procedure division giving s as string.
           move string::"Format"("{0}: {1}", KeyMember,
               ValueMember) to s
       end method   ToString.
      *>
       end class     KeyValuePair.